home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2001 / MacHack 2001.toast / pc / The Hacks / The Weakest Link / source / OpenTptEnet / CIncludes / dlpiuser.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-06-23  |  8.0 KB  |  252 lines

  1. /*
  2.     File:        dlpiuser.h
  3.  
  4.     Contains:    Copyright:    © 1993-1996 by Mentat Inc., all rights reserved.
  5.  
  6.     Version:    Mentat Inc, 2.x ?
  7.  
  8.     Copyright:    © 1997 by Apple Computer, Inc., all rights reserved.
  9.  
  10. */
  11.  
  12. /*
  13.     File:        dlpiuser.h
  14.  
  15.     Contains:    Header file for the DLPI template.  These are definitions
  16.                 that users need to take advantage of features in the DLPI drivers
  17.                 
  18.                  ** dlpiuser.h 5.3, last change 27 Mar 1996
  19.  
  20.     Copyright:    © 1996-1997 by Mentat Inc. and Apple Computer, Inc., all rights reserved.
  21.  
  22. */
  23.  
  24. #ifndef __DLPIUSER__
  25. #define __DLPIUSER__
  26.  
  27. #ifndef __OPENTRANSPORT__
  28. #include <OpenTransport.h>
  29. #endif
  30.  
  31. /* Flags for various structures. */
  32.  
  33. enum
  34. {
  35.     DL_NORMAL_STATUS    = 0x01,
  36.     DL_ERROR_STATUS        = 0x02,
  37.     DL_TRUNCATED_PACKET    = 0x04,
  38.     DL_VERSION            = 0x00,
  39.     DL_VERSION_BITS        = 0xF0000000
  40. };
  41.  
  42. /*
  43.  * Receive and send error flags, these should not overlap with other
  44.  * flags above.
  45.  */
  46. enum
  47. {
  48.     DL_CRC_ERROR        = 0x10,
  49.     DL_RUNT_ERROR        = 0x20,
  50.     DL_FRAMING_ERROR    = 0x40,
  51.     DL_BAD_802_3_LENGTH    = 0x80,
  52.     DL_ERROR_MASK        = DL_CRC_ERROR | DL_RUNT_ERROR | DL_FRAMING_ERROR | DL_BAD_802_3_LENGTH
  53. };
  54.  
  55. /* Input and output structure for I_OTSetRawMode kOTSetRecvMode ioctl. */
  56. struct dl_recv_control_t {
  57.     unsigned long    dl_primitive;
  58.     unsigned long    dl_flags;
  59.     unsigned long    dl_truncation_length;
  60. };
  61.  
  62. typedef struct dl_recv_control_t dl_recv_control_t;
  63.  
  64. /* Structure returned with every inbound packet after kOTSetRecvMode. */
  65. struct dl_recv_status_t {
  66.     unsigned long    dl_overall_length;
  67.     unsigned long    dl_flags;
  68.     unsigned long    dl_packet_length_before_truncation;
  69.     unsigned long    dl_pad;
  70.     OTTimeStamp        dl_timestamp;
  71. };
  72.  
  73. typedef struct dl_recv_status_t    dl_recv_status_t;
  74.  
  75. /* Input structure for I_OTSetRawMode kOTSendErrorPacket. */
  76. struct dl_send_control_t {
  77.     unsigned long    dl_primitive;
  78.     unsigned long    dl_flags;
  79. };
  80.  
  81. typedef struct dl_send_control_t    dl_send_control_t;
  82.  
  83. /*
  84.  * The statistics data in DL_GET_STATISTICS_ACK messages is structured
  85.  * as follows:
  86.  *
  87.  *    TOptionHeader
  88.  *    dle_interface_status_t
  89.  *    TOptionHeader
  90.  *    dle_ethernet_status_t
  91.  *
  92.  * Anyone reading the statistics should pay attention to the length fields
  93.  * in the TOptionHeader structures.  This will allow the statistics
  94.  * structures to grow in the future.
  95.  */
  96.  
  97. /* Level value for DL_GET_STATISTICS_ACK */
  98. enum
  99. {
  100.     DLPI_XTI_LEVEL        = 12
  101. };
  102.  
  103. /* Option names for DL_GET_STATISTICS_ACK */
  104. enum
  105. {
  106.     DL_INTERFACE_MIB        = 1,
  107.     DL_ETHERNET_MIB            = 2
  108. };
  109.  
  110. /*
  111.  * Interface MIB statistics (RFC 1573).  The receive counters are
  112.  * maintained by the common code in dlpiether.c.  The transmit counters
  113.  * must be maintained by the board-specific code; dlpiether code does
  114.  * not see outbound fast path packets and so it is impossible for the
  115.  * counters to be handled in common code.
  116.  */
  117. struct dle_interface_status_s {
  118.     /* Total number of octets received, including framing bytes. */
  119.     unsigned long    bytes_received;
  120.  
  121.     /* Number of packets, delivered by this sublayer to a higher layer,
  122.      * which were not addressed to a multicast or broadcast address. */
  123.     unsigned long    unicast_frames_received;
  124.  
  125.     /* Total number of octets transmitted, including framing characters. */
  126.     unsigned long    bytes_sent;
  127.  
  128.     /* Total number of packets that higher-level protocols requested
  129.      * be transmitted, and which were not addressed to a multicast
  130.      * or broadcast address, including those that were discarded or
  131.      * not sent. */
  132.     unsigned long    unicast_frames_sent;
  133.  
  134.     /* Number of packets, delivered by this sublayer to a higher layer,
  135.      * which were addressed to a multicast address. */
  136.     unsigned long    multicast_frames_received;
  137.  
  138.     /* Number of packets, delivered by this sublayer to a higher layer,
  139.      * which were addressed to a address. */
  140.     unsigned long    broadcast_frames_received;
  141.  
  142.     /* Number of inbound packets which were chosen to be discarded
  143.      * even though no errors had been detected to prevent their being
  144.      * deliverable to a higher-layer protocol.  The board-specific
  145.      * code should increment this count if it cannot deliver a
  146.      * packet for which dle_inbound_probe returned a valid cookie,
  147.      * for instance, if an mblk could not be allocated. */
  148.     unsigned long    receive_discards;
  149.  
  150.     /* Number of inbound packets that contained errors preventing them
  151.      * from being deliverable to a higher-layer protocol.  This count
  152.      * is created by the dle code from adding together all of Ethernet
  153.      * receive error counts. */
  154.     unsigned long    receive_errors;
  155.  
  156.     /* Number of packets received which were discarded because of an
  157.      * unknown or unsupported protocol. */
  158.     unsigned long    receive_unknown_protos;
  159.  
  160.     /* Total number of packets that higher-level protocols requested
  161.      * be transmitted, and which were addressed to a multicast address. */
  162.     unsigned long    multicast_frames_sent;
  163.  
  164.     /* Total number of packets that higher-level protocols requested
  165.      * be transmitted, and which were addressed to a broadcast address. */
  166.     unsigned long    broadcast_frames_sent;
  167.  
  168.     /* Number of outbound packets which were chosen to be discarded even
  169.      * though no errors had been detected to prevent their being
  170.      * transmitted.  One possible reason could be to free up buffer space.*/
  171.     unsigned long    transmit_discards;
  172.  
  173.     /* Number of outbound packets that could not be transmitted because
  174.      * of errors.  This count is created by the dle code when necessary
  175.      * by adding together all of the Ethernet transmit errors. The
  176.      * common code also adds in packets that could not be sent because
  177.      * they were malformed by the upper-level protocol. */
  178.     unsigned long    transmit_errors;
  179.  
  180.     /* Size of the largest packet which can be sent/received, in octets.
  181.      * Set to 1514 by default; board-specific software may change
  182.      * this after dle_install if a different size is supported. */
  183.     unsigned long    mtu;
  184.  
  185.     /* An estimate of the interface's current bandwidth in bits/second.
  186.      * The common code (dle_install) will set this value to 10Mb/second;
  187.      * if the board supports a higher speed, then internal code should
  188.      * change the value after calling dle_install. */
  189.     unsigned long    speed;
  190. };
  191.  
  192. typedef struct dle_interface_status_s    dle_interface_status_t;
  193.  
  194. /*
  195.  * Ethernet MIB statistics (RFC 1643).  These are maintained by the board-specific
  196.  * software as learned from the underlying hardware.
  197.  */
  198. struct dle_ethernet_status_s {
  199.     /* Identifies the chipset used to realize the interface. */
  200.     unsigned long    ether_chip_set;
  201.  
  202.     /* Frames received that are not an integral number of octets
  203.      * in length and do not pass the FCS check. */
  204.     unsigned long    receive_alignment_errors;
  205.  
  206.     /* Frames received that are an integral number of octets in
  207.      * length but do not pass the FCS check. */
  208.     unsigned long    receive_fcs_errors;
  209.  
  210.     /* Frames received that exceed the maximum permitted frame size. */
  211.     unsigned long    receive_frames_too_long;
  212.  
  213.     /* Frames for which reception fails due to an internal sublayer
  214.      * error.  Only counted here if not counted as any other error. */
  215.     unsigned long    receive_internal_mac_errors;
  216.  
  217.     /* Successfully transmitted frames for which transmission is
  218.      * inhibited by exactly one collision. */
  219.     unsigned long    transmit_single_collision_frames;
  220.  
  221.     /* Successfully transmitted frames for which transmission is
  222.      * inhibited by more than one collision. */
  223.     unsigned long    transmit_multiple_collision_frames;
  224.  
  225.     /* A count of times that the SQE TEST ERROR message is generated
  226.      * by the PLS sublayer. */
  227.     unsigned long    transmit_sqe_test_errors;
  228.  
  229.     /* Frames for which the first transmission attempt is delayed
  230.      * because the medium is busy. */
  231.     unsigned long    transmit_deferred_transmissions;
  232.  
  233.     /* The number of times that a collision is detected later than
  234.      * 512 bit-times into the transmission of a packet. */
  235.     unsigned long    transmit_late_collisions;
  236.  
  237.     /* Frames for which transmission fails due to excessive collisions. */
  238.     unsigned long    transmit_excessive_collisions;
  239.  
  240.     /* Frames for which transmission fails due to an internal sublayer
  241.      * error.  Count should be independent of collision counters. */
  242.     unsigned long    transmit_internal_mac_errors;
  243.  
  244.     /* The number of times that the carrier sense condition was lost
  245.      * or never asserted when attempting to transmit a frame. */
  246.     unsigned long    transmit_carrier_sense_errors;
  247. };
  248.  
  249. typedef struct dle_ethernet_status_s    dle_ethernet_status_t;
  250.  
  251. #endif
  252.